﻿<%@page language="java" contentType="text/html;charset=utf-8" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0030)http://localhost:8080/House-2/ -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>云和租房 - 首页</TITLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<LINK rel=stylesheet type=text/css href="../css/style.css">
<META name=GENERATOR content="MSHTML 8.00.7601.17514"></HEAD>
<BODY>
<DIV id=header class=wrap>
<DIV id=logo><IMG src="../images/logo.gif"></DIV></DIV>
<DIV id=navbar class=wrap>
<DL class="search clearfix">
  <FORM id=sform method=post action=search.action>
  <DT>
  <UL>
    <LI class=bold>房屋信息</LI>
    <LI>标题：<INPUT class=text type=text name=title id="title" value="请输入id或者名称"> <LABEL class=ui-blue><INPUT onclick=doSearch() value=搜索房屋 type=button name=search></LABEL>
    </LI></UL></DT>
  <DD>
  <UL>
    <LI class=first>价格 </LI>
    <LI><SELECT name=price id="jiage" onchange="doSearchByPrice()"> <OPTION selected value="">不限</OPTION> <OPTION
      value=0-100>100元以下</OPTION> <OPTION value=100-200>100元—200元</OPTION>
      <OPTION value=200-1000000>200元以上</OPTION></SELECT> </LI></UL></DD>
  <DD>
  <UL>
    <LI class=first>房屋位置</LI>
    <LI><SELECT id="street" name=street_id  onchange="doSearchByPrice()"> <OPTION selected
      value="">不限</OPTION> <OPTION value=1000>知春路</OPTION> <OPTION 
      value=1001>中关村大街</OPTION> <OPTION value=1002>学院路</OPTION> <OPTION 
      value=1003>朝阳路</OPTION></SELECT> </LI></UL></DD>
  <DD>
  <UL>
    <LI class=first>房型</LI>
    <LI><SELECT name=type_id id="fangxing" onchange="doSearchByPrice()"> <OPTION selected value="" >不限</OPTION> <OPTION
      value=1000>一室一厅</OPTION> <OPTION value=1001>一室两厅</OPTION> <OPTION 
      value=1002>两室一厅</OPTION> <OPTION value=1003>两室两厅</OPTION></SELECT> 
  </LI></UL></DD>
  <DD>
  <UL>
    <LI class=first>面积 </LI>
    <LI><SELECT name=floorage id="mianji" onchange="doSearchByPrice()"> <OPTION selected value="" >不限</OPTION> <OPTION
      value=0-40>40以下</OPTION> <OPTION value=40-500>40-500</OPTION> <OPTION 
      value=500-1000000>500以上</OPTION></SELECT> </LI></UL></DD></FORM></DL></DIV>
<DIV class="main wrap">
<TABLE class=house-list>
  <TBODY id="tbody1">
 </TBODY></TABLE>
<DIV class=pager>
<UL>
  <LI class=current><A href="#">首页</A></LI>
  <LI><A href="#">上一页</A></LI>
  <LI><A href="#">下一页</A></LI>
  <LI><A href="#">末页</A></LI></UL><SPAN 
class=total>1/2页</SPAN> </DIV></DIV>
<DIV id=footer class=wrap>
<DL>
  <DT>云和租房 © 2010 云和 京ICP证1000001号</DT>
  <DD>关于我们 · 联系方式 · 意见反馈 · 帮助中心</DD></DL></DIV></BODY></HTML>
<script src="scripts/jquery-1.8.3.js"></script>
<script>
 $(function () {
     $.ajax({
         type: "POST",
         url: "houselist.action",
         success: function(data){
             console.log(data);
             var houStr="";
             $.each(data,function (index,obj) {
                 houStr+="";
                 houStr+="<TR class=odd>\n" +
                     "    <TD class=house-thumb><span><A href=\"details.htm\" target=\"_blank\"><img src=\"../images/thumb_house.gif\" width=\"100\" height=\"75\" alt=\"\"></a></span></TD>\n" +
                     "    <TD>\n" +
                     "      <DL>\n" +
                     "        <DT><A href=\"details.htm\" target=\"_blank\">"+obj.houseTitle+"</A></DT>\n" +
                     "        <DD>"+obj.street.district.districtName+obj.street.streetName+","+obj.houseArea+"<BR>联系方式："+obj.houseContact+" </DD></DL></TD>\n" +
                     "    <TD class=house-type>"+obj.types.typeName+"</TD>\n" +
                     "    <TD class=house-price><SPAN>"+obj.housePrice+"</SPAN>元/月</TD></TR>\n"

             });
             $("#tbody1").html(houStr);

         }
     });
 });

 //进行搜索
 function doSearch() {
     $.ajax({
         type: "POST",
         url: "houselistSearch.action",
         data: {
             uname: $("#title").val()
         },
         success: function(data){
             console.log(data);

             var houStr="";
             $.each(data,function (index,obj) {
                 houStr+="";

                 houStr+="<TR class=odd>\n" +
                     "    <TD class=house-thumb><span><A href=\"details.htm\" target=\"_blank\"><img src=\"../images/thumb_house.gif\" width=\"100\" height=\"75\" alt=\"\"></a></span></TD>\n" +
                     "    <TD>\n" +
                     "      <DL>\n" +
                     "        <DT><A href=\"details.htm\" target=\"_blank\">"+obj.houseTitle+"</A></DT>\n" +
                     "        <DD>"+obj.street.district.districtName+obj.street.streetName+","+obj.houseArea+"<BR>联系方式："+obj.houseContact+" </DD></DL></TD>\n" +
                     "    <TD class=house-type>"+obj.types.typeName+"</TD>\n" +
                     "    <TD class=house-price><SPAN>"+obj.housePrice+"</SPAN>元/月</TD></TR>\n"

             });
             $("#tbody1").html(houStr);

         }
     });
 }
//后边的按条件搜索
 function doSearch11() {
     $.ajax({
         type: "POST",
         url: "houselistSearch.action",
         data: {
             uname: $("#title").val()
         },
         success: function(data){
             console.log(data);
             var houStr="";
             $.each(data,function (index,obj) {
                 houStr+="";

                 houStr+="<TR class=odd>\n" +
                     "    <TD class=house-thumb><span><A href=\"details.htm\" target=\"_blank\"><img src=\"../images/thumb_house.gif\" width=\"100\" height=\"75\" alt=\"\"></a></span></TD>\n" +
                     "    <TD>\n" +
                     "      <DL>\n" +
                     "        <DT><A href=\"details.htm\" target=\"_blank\">"+obj.houseTitle+"</A></DT>\n" +
                     "        <DD>"+obj.street.district.districtName+obj.street.streetName+","+obj.houseArea+"<BR>联系方式："+obj.houseContact+" </DD></DL></TD>\n" +
                     "    <TD class=house-type>"+obj.types.typeName+"</TD>\n" +
                     "    <TD class=house-price><SPAN>"+obj.housePrice+"</SPAN>元/月</TD></TR>\n"

             });
             $("#tbody1").html(houStr);

         }
     });
 }
 function doSearchByPrice() {
     $.ajax({
         type: "POST",
         url: "searchByPrice.action",
         data: {
             mianji: $("#mianji").val(),
             jiage: $("#jiage").val(),
             stree: $("#street").val(),
             fangxing: $("#fangxing").val(),
         },
         success: function(data){
             console.log(data);
             var houStr="";
             $.each(data,function (index,obj) {
                 houStr+="";
                 houStr+="<TR class=odd>\n" +
                     "    <TD class=house-thumb><span><A href=\"details.htm\" target=\"_blank\"><img src=\"../images/thumb_house.gif\" width=\"100\" height=\"75\" alt=\"\"></a></span></TD>\n" +
                     "    <TD>\n" +
                     "      <DL>\n" +
                     "        <DT><A href=\"details.htm\" target=\"_blank\">"+obj.houseTitle+"</A></DT>\n" +
                     "        <DD>"+obj.street.district.districtName+obj.street.streetName+","+obj.houseArea+"<BR>联系方式："+obj.houseContact+" </DD></DL></TD>\n" +
                     "    <TD class=house-type>"+obj.types.typeName+"</TD>\n" +
                     "    <TD class=house-price><SPAN>"+obj.housePrice+"</SPAN>元/月</TD></TR>\n"

             });
             $("#tbody1").html(houStr);

         }
     });
 }
</script>
]